package cn.itsource.factory;

import cn.itsource.api.LoginFeignClient;
import cn.itsource.pojo.domain.Login;
import cn.itsource.result.JSONResult;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class LoginFeignClientFactory implements FallbackFactory<LoginFeignClient> {


    @Override
    public LoginFeignClient create(Throwable cause) {
        return new LoginFeignClient() {
            @Override
            public JSONResult create(Login login) {
                return JSONResult.error(cause.getMessage());
            }
        };
    }
}
